package cn.com.fuhuitong.main.mine.ui.activity

import cn.com.fuhuitong.aroute.ARouteConstance
import cn.com.fuhuitong.main.base.ViewModeActivity
import com.alibaba.android.arouter.facade.annotation.Route
import com.blankj.utilcode.util.SPStaticUtils
import cn.com.fuhuitong.R
import cn.com.fuhuitong.app.AppConstance
import cn.com.fuhuitong.base.ActivityCollector
import cn.com.fuhuitong.entity.AccessAction
import cn.com.fuhuitong.entity.MainBean
import cn.com.fuhuitong.main.mine.popup.SettingExitPopupWindow
import cn.com.fuhuitong.main.mine.vm.MineViewModel
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.AppUtils
import kotlinx.android.synthetic.main.activity_mine_setting.*

@Route(path = ARouteConstance.ACTIVITY_URL_MINE_SETTING)
class MineSettingActivity : ViewModeActivity<MineViewModel>() {

    override fun viewModel(): MineViewModel = createViewModel()

    override val layoutResId: Int
        get() = R.layout.activity_mine_setting

    override fun initView() {

        image_setting_back.setOnClickListener {
            this.finish()
        }

        text_version_name.text = AppUtils.getAppVersionName()

        text_mine_setting_exit.setOnClickListener {
            initSettingExitPopupWindow()
                .showPopupWindow()
        }

    }

    override fun initViewMode() {

    }

    private fun initSettingExitPopupWindow():
            SettingExitPopupWindow = SettingExitPopupWindow(this, {
        SPStaticUtils.clear()
        ActivityCollector.finishAll()
        ARouter.getInstance().build(ARouteConstance.ACTIVITY_URL_ACCESS)
            .navigation()
    }, {
        ActivityCollector.finishAll()
    }, {
        it.dismiss()
    })
}